﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using StudentManagement.Utils;

namespace StudentManagement.Forms
{
    public partial class NewStudentForm : Form
    {
        public NewStudentForm()
        {
            InitializeComponent();
        }

        // Event 
        public event EventHandler<StudentEventArgs> CreateClick;
        private void InvokeCreateClick(StudentEventArgs e)
        {
            var handler = CreateClick;
            if (handler != null)
            {
                handler(this, e);
            }
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            InvokeCreateClick(new StudentEventArgs(new Student {
                FullName = txtFullName.Text,
                Birthday = dtPickerBirthday.Value,
                Class = txtClass.Text,
                Address = txtAddress.Text})
            );
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
